function submitPatientForm(idPatient)	{
	// Partie validation du formulaire
	if (document.getElementById("date-from").value.length != 10) {
		window.location="../pages/ajout_patient.php?id="+idPatient+"&msg=dateFormat";
	} else {
		document.addPatient.submit();
	}
}
function consultations(idPatient)	{
	window.location='afficher_consultations.php?msg=&idPatient='+idPatient;
}
function findAge()	{
	var ladate=new Date()
	if (document.getElementById("date-from").value != '') {
		document.getElementById("age").innerHTML = (parseInt(ladate.getFullYear()) - parseInt(document.getElementById("date-from").value.split("/")[2])) + " ans";
	}	
}
function addFamily() {
	if (document.getElementById("relation").style.visibility == "visible") {
		document.getElementById("relation").style.visibility = "hidden";
	} else {
	document.getElementById("relation").style.visibility = "visible"; 
	}
}
function showAdministrativeTab() {
	if (document.getElementById("administratif").style.visibility != "visible") {
		document.getElementById("administratif").style.visibility = "visible";	
		document.getElementById("antecedent").style.visibility = "hidden";
		document.getElementById("relation").style.visibility = "hidden";	
		document.getElementById("buttonAdmin").className = "buttonOn";		
		document.getElementById("buttonMedical").className = "button";						
		document.getElementById("buttonAntecedent").className = "button";						
		document.getElementById("medical").style.visibility = "hidden";
	} else {
		
		document.getElementById("ville").style.visibility = "hidden";						
	}
}
function showDoctorDetails() {
		document.getElementById("notesDetails").innerHTML = "toto";
}
function showMedicalTab() {
	if (document.getElementById("medical").style.visibility != "visible") {
		document.getElementById("medical").style.visibility = "visible";				
		document.getElementById("relation").style.visibility = "hidden";	
		document.getElementById("administratif").style.visibility = "hidden";
		document.getElementById("antecedent").style.visibility = "hidden";
		document.getElementById("buttonAdmin").className = "button";		
		document.getElementById("buttonMedical").className = "buttonOn";						
		document.getElementById("buttonAntecedent").className = "button";						
	}
}
function confirmDelete(url, msg) {
	if (confirm(msg)) {
		window.location = url;
	}
}
function showAntecedentTab() {
	if (document.getElementById("antecedent").style.visibility != "visible") {
		document.getElementById("antecedent").style.visibility = "visible";				
		document.getElementById("relation").style.visibility = "hidden";	
		document.getElementById("administratif").style.visibility = "hidden";
		document.getElementById("medical").style.visibility = "hidden";
		document.getElementById("buttonAdmin").className = "button";		
		document.getElementById("buttonMedical").className = "button";						
		document.getElementById("buttonAntecedent").className = "buttonOn";						
	}
}
function submitConsultationForm(idPatient)	{
	if (document.getElementById("date-consult").value.length != 10) {
		if (document.getElementById("id").value == 'null') {
			window.location = "../pages/ajout_consultation.php?msg=dateFormat&id=0&idPatient="+idPatient;
		} else {
			window.location = "../pages/ajout_consultation.php?msg=dateFormat&id="+document.getElementById("id").value+"&idPatient="+idPatient;
		}
	} else {
		document.addConsultation.submit();
	}
}
function retourPatient(idPatient)	{
	window.location='ajout_patient.php?msg=&id='+idPatient;
}

/* Partie recherche */
function showSearchPatientTab() {
	if (document.getElementById("recherche1").style.visibility != "visible") {
		document.getElementById("recherche1").style.visibility = "visible";	
		document.getElementById("search2Tab").className = "blue";
		document.getElementById("search1Tab").className = "orange";
		document.getElementById("recherche2").style.visibility = "hidden";	
		if (document.getElementById("resultConsultation") != null)
			document.getElementById("resultConsultation").style.visibility = "hidden";
		if (document.getElementById("resultPatient") != null)	
			document.getElementById("resultPatient").style.visibility = "visible";
	}
}
function showSearchConsultationTab() {
	if (document.getElementById("recherche2").style.visibility != "visible") {
		document.getElementById("recherche2").style.visibility = "visible";
		document.getElementById("search1Tab").className = "blue";
		document.getElementById("search2Tab").className = "orange";
		document.getElementById("recherche1").style.visibility = "hidden";
		if (document.getElementById("resultPatient") != null)
			document.getElementById("resultPatient").style.visibility = "hidden";
		if (document.getElementById("resultConsultation") != null)	
			document.getElementById("resultConsultation").style.visibility = "visible";
	}
}

/* Partie administration */
function showAdminDataTab() {
	if (document.getElementById("data").style.visibility != "visible") {
		hideAdminDiv();
		document.getElementById("data").style.visibility = "visible";
		document.getElementById("defaultTab").className = "blue";
		document.getElementById("referenceTab").className = "blue";
		document.getElementById("dataTab").className = "orange";
		document.getElementById("default").style.visibility = "hidden";
		document.getElementById("reference").style.visibility = "hidden";
	}
}
function showConfigDataTab() {
	if (document.getElementById("data").style.visibility != "visible") {
		hideConfigDiv();
		document.getElementById("data").style.visibility = "visible";
		document.getElementById("defaultTab").className = "blue";
		document.getElementById("referenceTab").className = "blue";
		document.getElementById("dataTab").className = "orange";
		document.getElementById("default").style.visibility = "hidden";
		document.getElementById("reference").style.visibility = "hidden";
	}
}
function showReferenceTab() {
	if (document.getElementById("reference").style.visibility != "visible") {
		document.getElementById("reference").style.visibility = "visible";	
		document.getElementById("default").style.visibility = "hidden";
		document.getElementById("defaultTab").className = "blue";
		document.getElementById("dataTab").className = "blue";
		document.getElementById("referenceTab").className = "orange";
		document.getElementById("data").style.visibility = "hidden";
	}
}
function showDefaultTab() {
	if (document.getElementById("default").style.visibility != "visible") {
		document.getElementById("default").style.visibility = "visible";	
		document.getElementById("defaultTab").className = "orange";
		document.getElementById("dataTab").className = "blue";
		document.getElementById("referenceTab").className = "blue";
		document.getElementById("data").style.visibility = "hidden";
		document.getElementById("reference").style.visibility = "hidden";
	}
}
function showReferenceConfigDoctorTab() {
	showReferenceTab();
	addConfigDoctor();
	printDoctors();
}
function showReferenceAdminSpecialityTab() {
	showReferenceTab();
	addAdminSpeciality();
	printSpecialities();
}
function showReferenceConfigSpecialityTab() {
	showReferenceTab();
	addConfigSpeciality();
	printSpecialities();
}
function showReferenceConfigReasonTab() {
	showReferenceTab();
	addConfigReason();
	printReasons();
}
function showReferenceAdminReasonTab() {
	showReferenceTab();
	addAdminReason();
	printReasons();
}
function showReferenceConfigRecommendationTab() {
	showReferenceTab();
	addConfigRecommendation();
	printRecommendations();
}
function showReferenceAdminRecommendationTab() {
	showReferenceTab();
	addAdminRecommendation();
	printRecommendations();
}
function showReferenceAdminCountryTab() {
	showReferenceTab();
	addAdminCountry();
	printCountries();
}
function showReferenceConfigCityTab() {
	showReferenceTab();
	addConfigCity();
	printCities();
	document.getElementById("villeTab").className = "orange";
	document.getElementById("medecinTab").className = "white";
}
function hideAdminDiv() {
	document.getElementById("pays").style.visibility = "hidden";
	document.getElementById("specialite").style.visibility = "hidden";
	document.getElementById("recommandation").style.visibility = "hidden";	
	document.getElementById("motif").style.visibility = "hidden";
}
function hideConfigDiv() {
	document.getElementById("ville").style.visibility = "hidden";
	document.getElementById("specialite").style.visibility = "hidden";
	document.getElementById("recommandation").style.visibility = "hidden";	
	document.getElementById("motif").style.visibility = "hidden";
	document.getElementById("medecin").style.visibility = "hidden";						
}
/*
 * City : Config
 * Country : Admin
 * Reason : Admin / Config
 * Doctor : Config
 * Recommendation : Config
 * Specialite : Admin / Config
 * 
 */
function uncolorAdminSubTab() {
	document.getElementById("recommandationTab").className = "white";
	document.getElementById("motifTab").className = "white";
	document.getElementById("paysTab").className = "white";
	document.getElementById("specialiteTab").className = "white";
}
function uncolorConfigSubTab() {
	document.getElementById("villeTab").className = "white";
	document.getElementById("recommandationTab").className = "white";
	document.getElementById("motifTab").className = "white";
	document.getElementById("medecinTab").className = "white";
	document.getElementById("specialiteTab").className = "white";
}
function addConfigDoctor() {
	if (document.getElementById("medecin").style.visibility != "visible") {
		uncolorConfigSubTab();
		hideConfigDiv();
		document.getElementById("medecinTab").className = "orange";
		document.getElementById("medecin").style.visibility = "visible";
	}
}
function addConfigSpeciality() {
	if (document.getElementById("specialite").style.visibility != "visible") {
		uncolorConfigSubTab();
		hideConfigDiv();
		document.getElementById("specialiteTab").className = "orange";
		document.getElementById("specialite").style.visibility = "visible";
	}
}
function addAdminSpeciality() {
	if (document.getElementById("specialite").style.visibility != "visible") {
		uncolorAdminSubTab();
		hideAdminDiv();
		document.getElementById("specialiteTab").className = "orange";
		document.getElementById("specialite").style.visibility = "visible";
	}
}
function addAdminReason() {
	if (document.getElementById("motif").style.visibility != "visible") {
		uncolorAdminSubTab();
		hideAdminDiv();
		document.getElementById("motifTab").className = "orange";
		document.getElementById("motif").style.visibility = "visible";
	}
}
function addConfigReason() {
	if (document.getElementById("motif").style.visibility != "visible") {
		uncolorConfigSubTab();
		hideConfigDiv();
		document.getElementById("motifTab").className = "orange";
		document.getElementById("motif").style.visibility = "visible";
	}
}
function addAdminRecommendation() {
	if (document.getElementById("recommandation").style.visibility != "visible") {
		uncolorAdminSubTab();
		hideAdminDiv();
		document.getElementById("recommandationTab").className = "orange";
		document.getElementById("recommandation").style.visibility = "visible";				
	}
}
function addConfigRecommendation() {
	if (document.getElementById("recommandation").style.visibility != "visible") {
		uncolorConfigSubTab();
		hideConfigDiv();
		document.getElementById("recommandationTab").className = "orange";
		document.getElementById("recommandation").style.visibility = "visible";				
	}
}
function addAdminCountry() {
	if (document.getElementById("pays").style.visibility != "visible") {
		uncolorAdminSubTab();
		hideAdminDiv();
		document.getElementById("paysTab").className = "orange";
		document.getElementById("pays").style.visibility = "visible";				
	}
}
function addConfigCity() {
	if (document.getElementById("ville").style.visibility != "visible") {
		uncolorConfigSubTab();
		hideConfigDiv();
		document.getElementById("villeTab").className = "orange";
		document.getElementById("ville").style.visibility = "visible";				
	}
}

/* Partie inscription */
function showContextTab() {
	if (document.getElementById("step1context").style.visibility != "visible") {
		document.getElementById("step1context").style.visibility = "visible";
		document.getElementById("subscribeContextTab").className = "orange";
		document.getElementById("subscribeDoctorTab").className = "blue";
		document.getElementById("subscribeDoctorTab").className = "blue";
		document.getElementById("step2holder").style.visibility = "hidden";
		document.getElementById("step3go").style.visibility = "hidden";
	}
}
function showDoctorTab() {
	if (document.getElementById("step2holder").style.visibility != "visible") {
		document.getElementById("step2holder").style.visibility = "visible";
		document.getElementById("subscribeContextTab").className = "orange";
		document.getElementById("subscribeGoTab").className = "blue";
		document.getElementById("subscribeDoctorTab").className = "orange";
		document.getElementById("step1context").style.visibility = "hidden";
		document.getElementById("step3go").style.visibility = "hidden";
	}
}
function showGoTab() {
	if (document.getElementById("step3go").style.visibility != "visible") {
		document.getElementById("step3go").style.visibility = "visible";
		document.getElementById("subscribeContextTab").className = "orange";
		document.getElementById("subscribeDoctorTab").className = "orange";
		document.getElementById("subscribeGoTab").className = "orange";
		document.getElementById("step1context").style.visibility = "hidden";
		document.getElementById("step2holder").style.visibility = "hidden";
	}
}



/* Partie recherche */
function showSubscribeStep1() {
	if (document.getElementById("step1").style.visibility != "visible") {
		document.getElementById("step1").style.visibility = "visible";	
		document.getElementById("step2Tab").className = "blue";
		document.getElementById("step3Tab").className = "blue";
		document.getElementById("step1Tab").className = "orange";
		document.getElementById("step2").style.visibility = "hidden";	
		document.getElementById("step3").style.visibility = "hidden";		
		if (document.getElementById("resultConsultation") != null)
			document.getElementById("resultConsultation").style.visibility = "hidden";
		if (document.getElementById("resultPatient") != null)	
			document.getElementById("resultPatient").style.visibility = "visible";
	}
}
function showSubscribeStep2() {
	if (document.getElementById("step2").style.visibility != "visible") {
		document.getElementById("step2").style.visibility = "visible";
		document.getElementById("step1Tab").className = "orange";
		document.getElementById("step2Tab").className = "orange";
		document.getElementById("step3Tab").className = "blue";		
		document.getElementById("step1").style.visibility = "hidden";
		document.getElementById("step3").style.visibility = "hidden";		
		if (document.getElementById("resultPatient") != null)
			document.getElementById("resultPatient").style.visibility = "hidden";
		if (document.getElementById("resultConsultation") != null)	
			document.getElementById("resultConsultation").style.visibility = "visible";
	}
}
function showSubscribeStep3() {
	if (document.getElementById("step3").style.visibility != "visible") {
		document.getElementById("step3").style.visibility = "visible";
		document.getElementById("step1Tab").className = "orange";
		document.getElementById("step2Tab").className = "orange";
		document.getElementById("step3Tab").className = "orange";
		document.getElementById("step1").style.visibility = "hidden";
		document.getElementById("step2").style.visibility = "hidden";
		if (document.getElementById("resultPatient") != null)
			document.getElementById("resultPatient").style.visibility = "hidden";
		if (document.getElementById("resultConsultation") != null)	
			document.getElementById("resultConsultation").style.visibility = "visible";
	}
}

// Partie menu
